Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unified some string translations #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tempura-san
Copy link
Contributor

Here is a small start which should fix at least some redundancies. Basically I have renamed some QML files and added class names before the tr() function when applicable.
@RobertMe I had to add some conditional stuff to your mpris additions in order to keep the Qt4 based flavours buildable (e2e67bd). Could you please check if they are neutral for Sailfish?
@mzanetti Please check also for the Ubuntu UI.
Some more strings will be unified, once I finish reworking Harmattan and Maemo stuff - but this will take some more time. And also then, we cannot get completely rid of duplicates... Most likely an ID based translation approach would work best, but this would need a major overhaul.

@RobertMe
Copy link
Contributor

Looks ok on a first quick check (without compiling) and should make translating indeed a lot easier. The changes to make the tr calls on another class (changing tr('Foo') to Foo::tr('Foo')) are to get them called on the same class which makes sure they are merged I guess?
Switching to id based translations might indeed be better for the future, if this completely gets rid of the duplicates (independent of file name etc). But biggest challenge then would be to get all the translations updated, as I guess all existing translations (on Transifex) would be dropped then?

@mzanetti I would prefer it if this could be hold back until after a 2.1 release, unless we're absolutely sure no new translations will be needed after these changes. As Transifex is currently in a pretty good shape. Adding new translations (or changing existing ones) means we'll need to wait again until (the maintained ones) are updated.

@tempura-san
Copy link
Contributor Author

@RobertMe Qt disambiguates strings by context. In the case of C++ files, each QObject derived class has a static tr() function, which can of course be called from everywhere. The class defines the context and thus reduces the number of duplicates if the same string with the same context is found.
Diambuiguating inside the same class, can be done, by adding a second parameter to tr() - but in Kodimote's case this is not needed.
When it comes to QML it is a bit "ugly": The basic context here is the QML file's name. Thus renaming the QML files solves this. The problem is that if you implement dialogs in different files, and each of them has a 'Cancel' button, you will get about six instances of the same string (as it is at the moment). I do not know of a different apprach for QML files, besides walking the ID road...

But my concerns are exactly the same as yours - I think it will invalidate all translations... I don't know if a mixture is possible - so for common strings like 'Ok' and 'Cancel' use the IDs, for other stuff keep it like it is. The drawback is, that each UI needs to share the same structure QML-wise, otherwise we will get different contexts again.

@RobertMe
Copy link
Contributor

If they can be combined (line and id based) IMO it would be best to first replace the generic ones, like Cancel, Ok, Media, Now Playing, Keypad, ..., as those are also the most annoying. And then creating all the new ones using ids, and one by one, when needed, replacing the remaining ones.

@mzanetti
Copy link
Owner

I've tested it and it looks quite good here. I agree that I'd like to hold this back until after 2.1 though.

@tempura-san Renaming qml files in the ubuntu port requires you to update the qrc file too (It complains about SettingsSheet.qml not found right now).

@tempura-san
Copy link
Contributor Author

@mzanetti Thanks for the hint - I have updated the pull request (always wanted to try a forced push ;)).

@RobertMe
Copy link
Contributor

Building fine on Sailfish too.

When updating the translations I've found another issue which we have to put some thoughts in, when we're going for an id based approach. Sometimes different apps use different lines. Sailfish uses `Do you want to resume playback from ...?" in a Yes/No based dialog approach (Sailfish default), while Ubuntu uses "Resume from ..." in a popup menu based approach (the same as Kodi shows it). So in those cases we still need multiple lines for the different apps, although those would of course be rare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants